<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
<title></title>

<!-- Bootstrap core CSS -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">

  <!-- Optional Bootstrap Theme -->
  <link href="data:text/css;charset=utf-8," data-href="bootstrap/css/bootstrap-theme.min.css" rel="stylesheet" id="bs-theme-stylesheet">

<!-- Documentation extras -->
<link href="bootstrap/css/docs.min.css" rel="stylesheet">
<!--[if lt IE 9]><script src="../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="bootstrap/js/ie-emulation-modes-warning.js"></script>

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
  <script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.js"></script>
  <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<!-- Favicons -->
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="icon" href="/favicon.ico">

<!-- Placed at the end of the document so the pages load faster -->
<script src="bootstrap/js/jquery.min.js"></script>


  <script src="bootstrap/js/bootstrap.min.js"></script>



  <script src="bootstrap/js/docs.min.js"></script>




         <style type="text/css">
         	#add{
         		width: 50%;
         		height: 600px;
         		margin-left: auto;
         		margin-right: auto;
         	}

         </style>
		<script type="text/javascript">		
		function checkcouid(){
			//获取用户名输入控件对象的内容
				var txtName = document.getElementById("couid").value;
				//信息提示框
				var sptxtName = document.getElementById("spancouid");
				if(txtName == null || txtName == ""){
					//验证失败
					isChecked = false;
					//提示信息					
					sptxtName.innerHTML = "请输入课程ID！";
					sptxtName.style.color = "#B92C28";
					//msg += "请输入姓名！\n"
//					document.getElementById("txtName").focus();
					//修改标志变量
					return false;
				}else{
					sptxtName.innerHTML="";
					//修改标志变量
					return true;
				}
		}
		function checkcouname(){
			//获取用户名输入控件对象的内容
				var txtName = document.getElementById("couname").value;
				//信息提示框
				var sptxtName = document.getElementById("spancouname");
				if(txtName == null || txtName == ""){
					//验证失败
					isChecked = false;
					//提示信息					
					sptxtName.innerHTML = "请输入课程名！";
					sptxtName.style.color = "#B92C28";
					//msg += "请输入姓名！\n"
//					document.getElementById("txtName").focus();
					//修改标志变量
					return false;
				}else{
					sptxtName.innerHTML="";
					//修改标志变量
					return true;
				}
		}
		
		function checkAll(){
			//课程验证
			var ischcouid = checkcouid();
			var ischcouname = checkcouname();
			
			
			if(ischcouid && ischcouname){
				//验证通过
				return true;
			}else{				
				return false;
			}
		}
		</script>

<%
	String path = request.getContextPath();
	// 获得本项目的地址(例如: http://localhost:8080/MyApp/)赋值给basePath变量 
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	// 将 "项目路径basePath" 放入pageContext中，待以后用EL表达式读出。 
	pageContext.setAttribute("basePath", basePath);
	//out.write(basePath);
%>
  </head>
     <body>
     	
     	<div id="add">
     		
     		<div class="page-header">
      	 <h1><span class="glyphicon glyphicon-leaf"></span>&nbsp;&nbsp;&nbsp;信&nbsp;息&nbsp;录&nbsp;入</h1>
     	</div>
      	 <form action="<%=basePath %>AddNewCourse" method="post">
     	<div class="row">
      	 <div class="col-md-4" align="center"><font face="仿宋" size="4">输&nbsp;入&nbsp;课&nbsp;程&nbsp;ID</font></div>
        	 <div class="col-md-5">
        	 <input type="text" class="form-control" id="couid" name="couid" placeholder="请输入课程id" onblur="checkcouid();">
      	   </div>
      	 <div class="col-md-3"><span id="spancouid"></span></div>
      	 </div>
      	 <hr>
      	<div class="row">
      	 <div class="col-md-4" align="center"><font face="仿宋" size="4">输&nbsp;入&nbsp;课&nbsp;程&nbsp;名</font></div>
        	 <div class="col-md-5">
        	 <input type="text" class="form-control" id="couname" name="couname" placeholder="请输入课程名" onblur="checkcouname();">
      	   </div>
      	 <div class="col-md-3"><span id="spancouname"></span></div>      	   
      	 </div>

      <div class="row">
        	 <div class="col-sm-offset-2 col-md-2" >
        	   <button type="submit" class="btn btn-default" onclick="return checkAll();">&nbsp;提&nbsp;&nbsp;&nbsp;交&nbsp;</button>
        	 </div>
        	 <div class="col-sm-offset-2 col-md-4">
        	   <button type="reset" class="btn btn-default" style="column-span: all;">&nbsp;重&nbsp;&nbsp;&nbsp;置&nbsp;</button>
        	 </div>
       	</div>
</form>      	 
     	</div>
     	


<!-- Bootstrap core JavaScript
================================================== -->



<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="bootstrap/js/ie10-viewport-bug-workaround.js"></script>


  </body>
</html>
